import { useState, useEffect } from 'react'
import './App.css'
import { FileList } from './components/FileList'
import { FileUpload } from './components/FileUpload'
import { API } from './api/api'

function App() {
  
  const [dataList, setDataList] = useState([]);

  useEffect(() => {
    loadData();
  }, [])

  const loadData = () => {
    API.getFileList({fileName: ""}).then(resp => {
      setDataList(resp.data);
    });
  }

  return (
    <>
      <h1>远程文件</h1>
      <FileUpload reload={loadData} />
      <FileList reload={loadData} dataList={dataList} />
    </>
  )
}

export default App
